package com.mybook.app.utils;

import java.util.Random;

/**
 * Created by hdl on 2017/11/3.
 */
public final class RandomUtils {

    /**
     * 生产随机数
     */

    //随机验证码
    public static String randomNumber(Integer length) {
        Logger.debug(RandomUtils.class, "随机数生成");
        StringBuffer sb = new StringBuffer();
        Random r = new Random(System.nanoTime());
        for (int i = 0; i < length; i++) {
            sb.append(r.nextInt(10) + "");
        }
        return sb.toString();
    }

}
